package com.global.emc.dao.impl;

import java.io.Serializable;
import java.util.List;

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSession;
import org.mybatis.spring.SqlSessionTemplate;

import com.global.emc.dao.EMCMyBatisDAO;

/**
 * 
 * @Description: [一句话描述该类的功能]
 * @Author: [Joly]
 * @CreateDate: [2014年1月15日 下午3:14:26]
 * @UpdateUser: [Joly]
 * @UpdateDate: [2014年1月15日 下午3:14:26]
 * @UpdateRemark: [说明本次修改内容]
 * @Version: [v1.0]
 * 
 */
public abstract class EMCMyBatisDAOImpl<T, ID extends Serializable> implements EMCMyBatisDAO<T, ID> {

	private SqlSession sqlSession;

	@Resource
	public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
		this.sqlSession = sqlSessionTemplate;
	}

	protected T selectOne(String statement) {
		return sqlSession.selectOne(statement);
	}

	protected T selectOne(String statement, Object parameter) {
		return sqlSession.selectOne(statement, parameter);
	}

	protected List<T> selectList(String statement) {
		return sqlSession.selectList(statement);
	}

	protected List<T> selectList(String statement, Object parameter) {
		return sqlSession.selectList(statement, parameter);
	}

	protected int insert(String statement) {
		return sqlSession.insert(statement);
	}

	protected int insert(String statement, Object parameter) {
		return sqlSession.insert(statement, parameter);
	}

	protected int update(String statement) {
		return sqlSession.update(statement);
	}

	protected int update(String statement, Object parameter) {
		return sqlSession.update(statement, parameter);
	}

	protected int delete(String statement) {
		return sqlSession.delete(statement);
	}

	protected int delete(String statement, Object parameter) {
		return sqlSession.delete(statement, parameter);
	}

}
